package com.taxi.controller;

import com.taxi.dto.Car;
import com.taxi.result.Result;
import com.taxi.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class CarController {
    @Autowired
    private CarService carService;

    /**
     * 查找所有车辆
     * @param page
     * @param limit
     * @param address
     * @param vehicleNo
     * @return
     */
    @GetMapping("/car/list")
    public Result getCarList(@RequestParam int page, @RequestParam int limit, @RequestParam(required = false) String address, @RequestParam(required = false) String vehicleNo){
        return carService.getCarList(page, limit, address, vehicleNo);
    }

    /**
     * 添加车辆Or修改车辆
     * @param car
     * @return
     */
    @PostMapping("/car")
    public Result addCar(@RequestBody Car car){
        return carService.addCar(car);
    }
}
